In data processing systems there is a general requirement for memory management as new data is stored and old data deleted from a memory, the available memory space can become fragmented. Over a period of time this can lead to the fragmentation of newly stored data with a consequent increase in the time required to retrieve that data from the memory. The conventional approach to this problem is to manage memory via the function calls brk, sbrk, malloc, calloc, realloc, etc. The functions brk and sbrk are low level primitives which are used to change dynamically the amount of space allocated for the calling process's data segment, or memory. These latter two functions are generally viewed as being too primitive for today's systems.
Current applications can use the malloc family of function calls to allocate blocks of memory at run time. Malloc uses sbrk or brk to change the size of the available process memory and then manages the memory as a list of allocated and free blocks of particular sizes. Malloc can provide an application on demand with a block of memory of any size. It does this by maintaining lists of free memory blocks and of their respective sizes so as to return a block which is at least as big as the block requested by the user. Therefore malloc must choose from the available blocks which of those blocks is most appropriate for giving to the application. The implementation of the malloc family of functions is system dependant, it is likely to vary from machine to machine.
This process suffers from the disadvantage that the use of the memory can be inefficient as it is generally necessary to allocate a memory block that is larger than required as any lesser available block will be too small. It is also necessary to expend processor time in the search for and identification of blocks of an appropriate size.